#!/bin/bash

set -e

version=v1.1.0
conf_file=docker-compose.yaml

if [ $# == 0 ]
then 
    echo "Please inut service names,multiple supported,eg: bash restart.sh app1 app2 app3"
    exit
fi

echo "[Ready to restart $*]"

for app in "$@"
do
    echo "[Stopping container ebike_$app]"
    docker stop ebike_$app > /dev/null

    echo "[Deleting image $app]"
    docker rmi -f ebike_registry/$app:$version

    echo "[Restart container]"
    docker compose up -d $app
done

echo "[Done!]"

